package Thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread ya = new Thread("亚古兽"){
            public void run(){
                System.out.println(getName()+"亚古兽进化！战斗暴龙兽！");
                try {
                    Thread.sleep(500000000);

                    System.out.println("一起上吧！太一！");
                } catch (InterruptedException e) {
                    e.printStackTrace();{
                        System.out.println(getName()+":勇气之力！");
                    }
                }
                System.out.println(getName()+":盖亚能量炮！");
            }
        };
        Thread tai = new Thread("太一"){
            public void run(){
                System.out.println(getName()+":站起来亚古兽，一起战斗吧！");
                for (int i=0;i<4;i++){
                    System.out.println(getName()+"加油，加油，加油！");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("嘣！");
                System.out.println("这就是友情的力量！");
                ya.interrupt();
            }
        };
        ya.start();
        tai.start();
    }
}
